# 1、导入头
import requests
from lxml import etree
url = 'https://www.qidian.com/all/'
for x in range(1,6):
    url = 'https://www.qidian.com/all/page'+ str(x)
    res = requests.get(url)
# 2、向网站服务器发起请求
    print(res.status_code)
    html = res.text
    ehtml = etree.HTML(html)
# 3、打印页面的html代码
    # print(html)
# 4、解析当前网页中的小说标题
    xtitle = ehtml.xpath("//h4/a/text()")
    print(xtitle)
# 5、解析当前网页中的小说作者
    xtitle = ehtml.xpath("//p[@class='author']/a[1]/text()")
    print(xtitle)
# 6、解析当前网页中的小说类型
    xtitle = ehtml.xpath("//p[@class='author']/a[2]/text()")
    print(xtitle)